<?php 

function trunc($phrase, $max_words) {

   $phrase_array = explode(' ',$phrase);

   if(count($phrase_array) > $max_words && $max_words > 0)

      $phrase = implode(' ',array_slice($phrase_array, 0, $max_words)).'...';

   return $phrase;

}

?>

<div class="content_pink text-center">

    <div class="cover">

        <div class="cover_images">

            <img src="/images/cover-sp.png"/>

        </div>

        <div class="cover_flower">

            <img src="/images/cover_flower.png"/>

        </div>

    </div><!--cover-->

    <div class="box_contact">

        <div class="content_contact">

            <div class="icon_flower1">

                <img src="/images/icon_flower1.png"/>

            </div>

            <div class="icon_flower2">

                <img src="/images/icon_flower2.png"/>

            </div>

            <div class="contact">

                <h1>Liên hệ</h1>

                <span>+84(4)6273-1346</span>

                <span>080-4135-6092</span>

            </div>

        </div>

    </div><!--lien he-->

</div><!--content-->

<div class="sp-list-product text-center kienthuc-con">

    <div class="sp-border-kienthuc">

        <div class="list-danhmuc">

            <div class="icon_flower4">

                <img src="/images/icon_flower_sp_hot.png"/>

            </div>

            <div class="content-danhmuc">

                <h1>KIẾN THỨC</h1>

                <ul>

                    <?php foreach($category as $cat) { ?>

                    <li <?php if($news['News']['news_category_id']==$cat['NewsCategory']['id']) { ?> class="active" <?php } ?>><?php

                    echo $this->Html->link(

                            trunc($cat['NewsCategory']['name'],5), array('controller' => 'News', 'action' => 'category', $cat['NewsCategory']['alias'])

                    );

                    ?></li>

                    <?php } ?>

                </ul>

            </div>

            <div class="content-danhmuc hot-news">

                <h1>BÀI NỔI BẬT</h1>

                <ul>

                    <?php foreach($other_news as $n) { ?> <li> <?php echo $this->Html->link(

                            trunc($n['News']['name'],5), array('controller' => 'News', 'action' => 'detail', $n['News']['alias']), array('escape' => false, 'title' => $n['News']['name'])

                    );

                    ?></li> <?php } ?>

                </ul>

            </div>

            <div class="content-danhmuc contact-support">

                <h1>HỖ TRỢ TRỰC TUYẾN</h1>

                <div class="yahoo-icon-small">

                    <a href="#"><img src="/images/yahoo_icon_small.png"/></a>

                    <a href="#"><img src="/images/yahoo_icon_small.png"/></a>

                    <a href="#"><img src="/images/yahoo_icon_small.png"/></a>

                    <a href="#"><img src="/images/yahoo_icon_small.png"/></a>

                </div>

                <div class="social-small">

                    <a href="#"><img src="/images/fb_skype.png"/></a>

                    <a href="#"><img src="/images/fb_icon.png"/></a>

                </div>

            </div>

        </div>

        <div class="noidung-kienthuc">

            <a href="#"><h1><?php echo $news['News']['name'] ?></h1></a>

            <p>

                <?php echo $news['News']['detail'] ?>

            </p>

        </div>

    </div>

</div>